Skip to content

refactor: remove unused variable newChannelId2channel in InitChannelCache - #2385

Open
octo-patch wants to merge 1 commit into
songquanpeng:mainfrom
octo-patch:fix/issue-2321-remove-unused-var-cache
Open

refactor: remove unused variable newChannelId2channel in InitChannelCache#2385
octo-patch wants to merge 1 commit into
songquanpeng:mainfrom
octo-patch:fix/issue-2321-remove-unused-var-cache

Conversation

@octo-patch

Copy link
Copy Markdown

Fixes #2321

Problem

In model/cache.go, the InitChannelCache function declares and populates a newChannelId2channel map but never reads from it afterward. This is dead code — the variable serves no purpose.

// Before: allocated and filled but never used
newChannelId2channel := make(map[int]*Channel)
for _, channel := range channels {
    newChannelId2channel[channel.Id] = channel
}

Solution

Remove the unused newChannelId2channel variable and its associated loop iteration. The remaining logic (building newGroup2model2channels and syncing it to group2model2channels) is unchanged.

Testing

No behaviour change — the removed code had no effect. Existing tests continue to pass.

…ache (fixes songquanpeng#2321)

The newChannelId2channel map was initialised and populated but never
read or returned anywhere in InitChannelCache. Remove the dead code to
keep the function clean.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InitChannelCache 函数中存在未使用的变量 newChannelId2channel

1 participant